Improve performance of retrieving HasMany relationships#230
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Currently, on
HasManywe call->$relationNamewhich internal queries the relation withselect *, we then filter these results withpluck().This causes relations to big datasets to be slow and fail as we're can be loading lots of data from the database and then filtering it in php.
Moving the pluck to the query allows us to filter in the database and keep all unused data out of php memory.
Summary by CodeRabbit